package com.zeng.mapper;

import com.zeng.pojo.User;
import org.mybatis.spring.SqlSessionTemplate;

import java.util.List;

/**
 * @author zeng
 * @date 2021/08/05 20:52
 */
public class UserMapperlmpl implements UserMapper{
    //所有的操作通过sqlsession
    //private SqlSessionTemplate sqlSession;
    //public void setSqlSession(SqlSessionTemplate sqlSession){
    //    this.sqlSession=sqlSession;
    //}
    //@Override
    //public List<User> getUsers() {
    //    UserMapper mapper = sqlSession.getMapper(UserMapper.class);
    //    return mapper.getUsers();
    //
    //}

    private SqlSessionTemplate sqlSession;

    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSession = sqlSession;
    }

    @Override
    public List<User> getUsers() {
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        return mapper.getUsers();
    }

}
